import java.net.URL;
import java.net.URLClassLoader;

public  class MyClassLoader extends URLClassLoader {
    public MyClassLoader(URL[] urls, ClassLoader parent) {
        super(urls, parent);
    }

    @Override
    public Class<?> loadClass(String name) throws ClassNotFoundException {
        // 如果类名是指定的类，则由当前类加载器加载
        if (name.equals("HashTabDemo")||name.equals("HashTab")||
                name.equals("EmpLinkedList")||name.equals("Emp")||
        name.equals("TempClass\\d+")) {
            return findClass(name);
        }
        // 否则委托给父类加载器
        return super.loadClass(name);
    }

    public void addURL(URL url){
        super.addURL(url);
    }

}

